home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / custcntl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  8.4 KB  |  211 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * custcntl.h -  Custom Control Library header file                            *
  4. *                                                                             *
  5. *               Copyright (c) 1992-1996, Microsoft Corp.  All rights reserved *
  6. *                                                                             *
  7. \*****************************************************************************/
  8.  
  9. #ifndef _INC_CUSTCNTL
  10. #define _INC_CUSTCNTL
  11. #pragma option push -b
  12.  
  13.  
  14. #ifdef __cplusplus
  15. extern "C" {            /* Assume C declarations for C++ */
  16. #endif  /* __cplusplus */
  17.  
  18.  
  19. /*
  20.  * General size defines.
  21.  */
  22. #define CCHCCCLASS          32          // Max chars in a class name.
  23. #define CCHCCDESC           32          // Max chars in a control description.
  24. #define CCHCCTEXT           256         // Max chars in a text field.
  25.  
  26.  
  27. /*
  28.  * CCSTYLE - Custom Control Style structure.  This structure is passed
  29.  * tp the Custom Control Style function when the user wants to edit the
  30.  * styles of the custom control.
  31.  */
  32. typedef struct tagCCSTYLEA {
  33.     DWORD   flStyle;                    // Style of the control.
  34.     DWORD   flExtStyle;                 // Extended style of the control.
  35.     CHAR    szText[CCHCCTEXT];          // Text of the control.
  36.     LANGID  lgid;                       // Language Id of the control's dialog.
  37.     WORD    wReserved1;                 // Reserved value.  Do not change.
  38. } CCSTYLEA, *LPCCSTYLEA;
  39.  
  40. typedef struct tagCCSTYLEW {
  41.     DWORD   flStyle;                    // Style of the control.
  42.     DWORD   flExtStyle;                 // Extended style of the control.
  43.     WCHAR   szText[CCHCCTEXT];          // Text of the control.
  44.     LANGID  lgid;                       // Language Id of the control's dialog.
  45.     WORD    wReserved1;                 // Reserved value.  Do not change.
  46. } CCSTYLEW, *LPCCSTYLEW;
  47.  
  48. #ifdef UNICODE
  49. #define CCSTYLE     CCSTYLEW
  50. #define LPCCSTYLE   LPCCSTYLEW
  51. #else
  52. #define CCSTYLE     CCSTYLEA
  53. #define LPCCSTYLE   LPCCSTYLEA
  54. #endif // UNICODE
  55.  
  56.  
  57. /*
  58.  * The Style function prototype.  This will be called when the user
  59.  * wants to edit the styles of a custom control.  It should display a
  60.  * dialog to edit the styles, update the styles in the pccs structure,
  61.  * then return TRUE for success.  If an error occurs or the user
  62.  * cancels the dialog, FALSE should be returned.
  63.  */
  64. typedef BOOL (CALLBACK* LPFNCCSTYLEA)(HWND hwndParent,  LPCCSTYLEA pccs);
  65. typedef BOOL (CALLBACK* LPFNCCSTYLEW)(HWND hwndParent,  LPCCSTYLEW pccs);
  66.  
  67. #ifdef UNICODE
  68. #define LPFNCCSTYLE LPFNCCSTYLEW
  69. #else
  70. #define LPFNCCSTYLE LPFNCCSTYLEA
  71. #endif  // UNICODE
  72.  
  73.  
  74. /*
  75.  * The SizeToText function prototype.  This will be called if the user
  76.  * requests that the custom control be sized to fit it's text.  It
  77.  * should use the specified styles, text and font to determine how
  78.  * large the control must be to accommodate the text, then return this
  79.  * value in pixels.  The value of -1 should be returned if an error
  80.  * occurs.
  81.  */
  82. typedef INT (CALLBACK* LPFNCCSIZETOTEXTA)(DWORD flStyle, DWORD flExtStyle,
  83.     HFONT hfont, LPSTR pszText);
  84. typedef INT (CALLBACK* LPFNCCSIZETOTEXTW)(DWORD flStyle, DWORD flExtStyle,
  85.     HFONT hfont, LPWSTR pszText);
  86.  
  87. #ifdef UNICODE
  88. #define LPFNCCSIZETOTEXT    LPFNCCSIZETOTEXTW
  89. #else
  90. #define LPFNCCSIZETOTEXT    LPFNCCSIZETOTEXTA
  91. #endif  // UNICODE
  92.  
  93.  
  94. /*
  95.  * CCSTYLEFLAG - Custom Control Style Flag structure.  A table of these
  96.  * structures is used to specify the define strings that match the
  97.  * different styles for a custom control.
  98.  */
  99. typedef struct tagCCSTYLEFLAGA {
  100.     DWORD flStyle;                      // Style bits for this style.
  101.     DWORD flStyleMask;                  // Mask for the style.  Can be zero.
  102.     LPSTR pszStyle;                     // Points to the style define string.
  103. } CCSTYLEFLAGA, *LPCCSTYLEFLAGA;
  104.  
  105. typedef struct tagCCSTYLEFLAGW {
  106.     DWORD flStyle;                      // Style bits for this style.
  107.     DWORD flStyleMask;                  // Mask for the style.  Can be zero.
  108.     LPWSTR pszStyle;                    // Points to the style define string.
  109. } CCSTYLEFLAGW, *LPCCSTYLEFLAGW;
  110.  
  111. #ifdef UNICODE
  112. #define CCSTYLEFLAG     CCSTYLEFLAGW
  113. #define LPCCSTYLEFLAG   LPCCSTYLEFLAGW
  114. #else
  115. #define CCSTYLEFLAG     CCSTYLEFLAGA
  116. #define LPCCSTYLEFLAG   LPCCSTYLEFLAGA
  117. #endif // UNICODE
  118.  
  119.  
  120. /*
  121.  * CCF_* defines.  These flags are used for the flOptions field of the
  122.  * CCINFO structure, and describe some basic characteristics of the
  123.  * custom control.
  124.  */
  125. #define CCF_NOTEXT          0x00000001  // Control cannot have text.
  126.  
  127.  
  128. /*
  129.  * CCINFO - Custom Control Info structure.  This structure provides
  130.  * the dialog editor with information about the control types that the
  131.  * DLL supports.
  132.  */
  133. typedef struct tagCCINFOA {
  134.     CHAR    szClass[CCHCCCLASS];        // Class name for the control.
  135.     DWORD   flOptions;                  // Option flags (CCF_* defines).
  136.     CHAR    szDesc[CCHCCDESC];          // Short, descriptive text for the ctrl.
  137.     UINT    cxDefault;                  // Default width (in dialog units).
  138.     UINT    cyDefault;                  // Default height (in dialog units).
  139.     DWORD   flStyleDefault;             // Default style (WS_CHILD | WS_VISIBLE).
  140.     DWORD   flExtStyleDefault;          // Default extended style.
  141.     DWORD   flCtrlTypeMask;             // Mask for control type styles.
  142.     CHAR    szTextDefault[CCHCCTEXT];   // Default text.
  143.     INT     cStyleFlags;                // Entries in the following style table.
  144.     LPCCSTYLEFLAGA aStyleFlags;         // Points to style flag table.
  145.     LPFNCCSTYLEA lpfnStyle;             // Pointer to the Styles function.
  146.     LPFNCCSIZETOTEXTA lpfnSizeToText;   // Pointer to the SizeToText function.
  147.     DWORD   dwReserved1;                // Reserved.  Must be zero.
  148.     DWORD   dwReserved2;                // Reserved.  Must be zero.
  149. } CCINFOA, *LPCCINFOA;
  150.  
  151. typedef struct tagCCINFOW {
  152.     WCHAR   szClass[CCHCCCLASS];        // Class name for the control.
  153.     DWORD   flOptions;                  // Option flags (CCF_* defines).
  154.     WCHAR   szDesc[CCHCCDESC];          // Short, descriptive text for the ctrl.
  155.     UINT    cxDefault;                  // Default width (in dialog units).
  156.     UINT    cyDefault;                  // Default height (in dialog units).
  157.     DWORD   flStyleDefault;             // Default style (WS_CHILD | WS_VISIBLE).
  158.     DWORD   flExtStyleDefault;          // Default extended style.
  159.     DWORD   flCtrlTypeMask;             // Mask for control type styles.
  160.     INT     cStyleFlags;                // Entries in the following style table.
  161.     LPCCSTYLEFLAGW aStyleFlags;         // Points to style flag table.
  162.     WCHAR   szTextDefault[CCHCCTEXT];   // Default text.
  163.     LPFNCCSTYLEW lpfnStyle;             // Pointer to the Styles function.
  164.     LPFNCCSIZETOTEXTW lpfnSizeToText;   // Pointer to the SizeToText function.
  165.     DWORD   dwReserved1;                // Reserved.  Must be zero.
  166.     DWORD   dwReserved2;                // Reserved.  Must be zero.
  167. } CCINFOW, *LPCCINFOW;
  168.  
  169. #ifdef UNICODE
  170. #define CCINFO      CCINFOW
  171. #define LPCCINFO    LPCCINFOW
  172. #else
  173. #define CCINFO      CCINFOA
  174. #define LPCCINFO    LPCCINFOA
  175. #endif // UNICODE
  176.  
  177.  
  178. /*
  179.  * The Info function prototype.  This function is the first one
  180.  * called by the dialog editor.  Custom control DLL's must export
  181.  * one or both of the following functions by name (the ordinal
  182.  * used for the export does not matter):
  183.  *
  184.  *  UINT CALLBACK CustomControlInfoA(LPCCINFOA acci)
  185.  *  UINT CALLBACK CustomControlInfoW(LPCCINFOW acci)
  186.  *
  187.  * This function must return the number of controls that the DLL
  188.  * supports, or NULL if an error occurs.  If the acci parameter is
  189.  * not NULL, it will be pointing to an array of CCINFOA or CCINFOW
  190.  * structures that should be filled in with the information about
  191.  * the different control types supported by the DLL.
  192.  *
  193.  * If both functions are present, the CustomControlInfoW function
  194.  * will be used by the dialog editor.
  195.  */
  196. typedef UINT (CALLBACK* LPFNCCINFOA)(LPCCINFOA acci);
  197. typedef UINT (CALLBACK* LPFNCCINFOW)(LPCCINFOW acci);
  198.  
  199. #ifdef UNICODE
  200. #define LPFNCCINFO  LPFNCCINFOW
  201. #else
  202. #define LPFNCCINFO  LPFNCCINFOA
  203. #endif  // UNICODE
  204.  
  205. #ifdef __cplusplus
  206. }
  207. #endif  /* __cplusplus */
  208.  
  209. #pragma option pop
  210. #endif  /* _INC_CUSTCNTL */
  211.